home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 October: Mac OS SDK / Dev.CD Oct 97 SDK1.toast / Development Kits (Disc 1) / AppleShare API / ServerEvent / ServerEventIntf.p < prev   
Encoding:
Text File  |  1992-05-19  |  6.7 KB  |  114 lines  |  [TEXT/MPS ]

  1. {
  2. Created: Monday, April 27, 1992 at 2:50 PM
  3.     ServerEventIntf.p
  4.     Pascal Interface to the Macintosh Libraries
  5.  
  6.         Copyright Apple Computer, Inc. 1990-1992
  7.         All rights reserved
  8. }
  9.  
  10. UNIT ServerEventIntf;
  11.  
  12. INTERFACE
  13.  
  14.     USES
  15.         AppleTalk;
  16.  
  17.     CONST
  18.        { Constants used in the tSEQEntry }
  19.     
  20.        { The SEeventFlag bits in tSEQEntry specify when the server event handler would like to be called. }
  21.        { SEeventFlag bits }
  22.         bCSEHAFPInDoRequest = 0;        { An AFP call is starting up (in DoRequest, about to be dispatched) }
  23.         bCSEHAFPInSendResponse = 1;        { An AFP call has completed (in SendResponse, about to send out the response) }
  24.         bCSEHServerBusy = 2;            { A new session is being denied because the server is busy (socket starvation event) }
  25.         bCSEHServerShutdown = 3;        { The server just shut down }
  26.         bCSEHServerControlCall = 4;        { A server control call has just completed }
  27.                                         { NOTE: The following server control calls do not cause a bCSEHServerControlCall server event: }
  28.                                         { SCStartServer, SCInstallServerEventProc, SCRemoveServerEventProc, SCGetServerEventProc, SCServerVersion, and SCWakeServer. }
  29.                                         { You can use the bCSEHServerStartup server event to detect server starts and wakeups. }
  30.         bCSEHShare = 5;                    { An HFS Share trap has just completed }
  31.         bCSEHUnShare = 6;                { An HFS UnShare trap has just completed }
  32.         bCSEHSetDirAccess = 7;            { An HFS SetDirAccess trap has just completed }
  33.         bCSEHServerNameChange = 8;        { An attempt was made to change the server name (the attempt may or may not have been successful) }
  34.         bCSEHVolumePrep = 9;            { A new volume was just prepared for use with AppleShare }
  35.         bCSEHVolumeUnmount = 10;        { A volume unmount was attempted on an AppleShare volume }
  36.         bCSEHServerStartup = 11;        { The server just successfully started up }
  37.         bCSEHSessionTornDown = 12;        { A user's session was torn down because any one of a number of reasons, including a }
  38.                                         { disconnect, server shutdown, timeout, or workstation initiated close session }
  39.         bCSEHOutOfSequence = 13;        { A packet was received out of sequence; the session may be a zombie }
  40.         bCSEHWksClosedSession = 14;        { A workstation closed its ASP session (i.e., it logged out) }
  41.         bCSEHSessionTimedOut = 15;        { A workstation's session timed out }
  42.         bCSEHSrvrClosedSession = 16;    { The server has closed a workstation's session }
  43.  
  44.         { When SEeventFlag bits bCSEHAFPInDoRequest or bCSEHAFPInSendResponse are set, the bits in SEwhichAFPFlag }
  45.         { determine which AFP calls will cause the server event handler to be called. }
  46.         { SEwhichAFPFlag bits }
  47.         {  bit 0  of SEwhichAFPFlag[1] - call SE handler when the AFPCommand = 192    (afpAddIcon) }
  48.         {  bit 1  of SEwhichAFPFlag[1] - call SE handler when the AFPCommand = 1    }
  49.         {  bit 2  of SEwhichAFPFlag[1] - call SE handler when the AFPCommand = 2    }
  50.         {  ...                                                                        }
  51.         {  bit 31 of SEwhichAFPFlag[1] - call SE handler when the AFPCommand = 31    }
  52.         {  bit 0  of SEwhichAFPFlag[0] - call SE handler when the AFPCommand = 32    }
  53.         {  ...                                                                        }
  54.         {  bit 63 of SEwhichAFPFlag[0] - call SE handler when the AFPCommand = 63    }
  55.         
  56.         { When SEeventFlag bit bCSEHServerControlCall is set, the bits in SEwhichSCFlag determine }
  57.         { which server control calls will cause the server event handler to be called. }
  58.         { SEwhichSCFlag bits }
  59.         {  bit 0  of SEwhichSCFlag - call SE handler when scCode = 0 (SCStartServer) }
  60.         {  ...                                                            }
  61.         {  bit 31 of SEwhichSCFlag - call SE handler when scCode = 31    }
  62.         
  63.         BufferMax = 48;                    { The maximum size of theBuffer in the ServerEventRecord }
  64.  
  65.  
  66.     TYPE
  67.         ServerEventRecordPtr = ^ServerEventRecord;
  68.         ServerEventRecord = RECORD
  69.             theEventNumber: LongInt;    { the server event that's occuring; see the SEeventFlag definitions above }
  70.             theServerTime: LongInt;        { the server time (in Macintosh DateTime form) }
  71.             theResult: OSErr;            { the result of the operation: }
  72.                 { if theEventNumber = bCSEHAFPInSendResponse: the AFP Error code to be returned }
  73.                 { if theEventNumber = bCSEHServerControlCall: the result of the server control call }
  74.                 { if theEventNumber = bCSEHShare, bCSEHUnShare, or bCSEHSetDirAccess: the result of the HFS call }
  75.                 { if theEventNumber = bCSEHServerNameChange: the result of a PRegisterName call, SECantRegNameErr, or SEDupNameErr }
  76.                 { if theEventNumber = bCSEHVolumeUnmount: noErr or fBsyErr (if volume is being used by a remote user) }
  77.                 { all other values of theEventNumber return noErr}
  78.             theBufSize: Integer;        { the number of bytes used in theBuffer }
  79.             theBuffer: PACKED ARRAY[1..BufferMax] OF Byte;
  80.                 { if theEventNumber = bCSEHAFPInDoRequest or bCSEHAFPInSendResponse: the first BufferMax bytes of the AFP packet }
  81.                 { if theEventNumber = bCSEHServerControlCall: the first BufferMax bytes of the SCParamBlockRec }
  82.                 { if theEventNumber = bCSEHShare, bCSEHUnShare, bCSEHSetDirAccess, bCSEHVolumePrep, or bCSEHVolumeUnmount: }
  83.                 {                     the first BufferMax bytes of the HParamBlockRec }
  84.                 { if theEventNumber = bCSEHServerNameChange: the new server name (in a Pascal string) }
  85.                 { all other values of theEventNumber return a zero length buffer }
  86.             theNameStr: Str31;            { the name of the file, if any; not always defined }
  87.             theAFPCommand: Integer;        { if theEventNumber = bCSEHAFPInDoRequest or bCSEHAFPInSendResponse, the AFP call number }
  88.  
  89.             { Note: If theEventNumber is bCSEHAFPInDoRequest, bCSEHAFPInSendResponse, bCSEHSessionTornDown, bCSEHOutOfSequence, }
  90.             { bCSEHWksClosedSession, bCSEHSessionTimedOut, or bCSEHSrvrClosedSession, then theUNRecID, theUNSUserID, }
  91.             { theUserName, and theSocketAddress of the user that made the call are returned.}
  92.                 
  93.             theUNRecID: LongInt;        {the UNRecID of the user that made the call}
  94.             theUNSUserID: LongInt;        {the UserID of the user that made the call}
  95.             theUserName: Str31;            {the name of the user that made the call}
  96.  
  97.             { Note: If theEventNumber is bCSEHAFPInDoRequest or bCSEHAFPInSendResponse, then theVRefNum and theDirID will be }
  98.             { returned if applicable to the AFP call}
  99.                 
  100.             theVRefNum: Integer;        { the VRefNum of the volume upon which this operation was performed (not always applicable) }
  101.             theDirID: LongInt;            { the DirID of the directory upon/within which this operation was performed (not always applicable)}
  102.             theSocketAddress: AddrBlock; { the network address of the user's workstation in AddrBlock format }
  103.             END;
  104.  
  105.         tSEQEntryPtr = ^tSEQEntry;
  106.         tSEQEntry = RECORD
  107.             SEQentry: ATQEntry;            { a regular AppleTalk Transition Queue entry }
  108.             SEeventFlag: LongInt;        { specifies when the Server Event Handler would like to be called }
  109.             SEwhichAFPFlag: ARRAY[0..1] OF LongInt;    { specifies which AFP calls will cause the Server Event Handler to be called }
  110.             SEwhichSCFlag: LongInt;        { specifies which Server Control calls will cause the Server Event Handler to be called }
  111.         END;
  112.  
  113. IMPLEMENTATION
  114. END.